using System;
using System.IO;
using System.Web.Mail;

namespace ProcessesSMS.Base
{
	/// <summary>
	/// Summary description for Utility.
	/// </summary>
	public class Utility
	{		
		public static bool SendMail(string body,string toMail,string strPath)
		{
			MailMessage oMessage = new MailMessage();

			oMessage.To = toMail;

			oMessage.From = "smscenter@vittelecom.vn";

			oMessage.Subject = body;

			oMessage.Body = "This is a test message.";

			oMessage.Fields["http://schemas.microsoft.com/cdo/configuration/sendusing"] = 2;

			oMessage.Fields["http://schemas.microsoft.com/cdo/configuration/smtpserver"] = "mail.vittelecom.vn";

			oMessage.Fields["http://schemas.microsoft.com/cdo/configuration/sendusername"] = "smscenter";

			oMessage.Fields["http://schemas.microsoft.com/cdo/configuration/sendpassword"] = "123456";

			oMessage.Fields["http://schemas.microsoft.com/cdo/configuration/smtpauthenticate"] = 1;	
		
			MailAttachment attach = new MailAttachment(strPath);

			oMessage.Attachments.Add(attach);

			try
			{
				SmtpMail.Send(oMessage);				
			}
			catch
			{
				return false;
			}
			return true;
		}	
	}
}
